﻿/********************************************************************************************************************
* Author:	Christos Polydorou																						*
* Email:	std04237@di.uoa.gr																						*
* Purpose:	This script is used in order to create the stored procedure "usp_user_deactivate" that deactivates a 	*
*			user.																									*
********************************************************************************************************************/

CREATE PROCEDURE [dbo].[usp_user_deactivate]
	@username nvarchar(50)
AS
	DECLARE @id bigint
	SELECT @id=ID
	FROM Users
	where users.Username = @username

	BEGIN
		UPDATE Users
		SET IsEnabled = '0'
		WHERE Username = @username
		RETURN 0
	END
RETURN 0